package com.lb.poitl.handler;

import org.jsoup.nodes.TextNode;

import com.deepoove.poi.data.TextRenderData;
import com.deepoove.poi.data.style.Style;
import com.deepoove.poi.policy.TextRenderPolicy;
import com.lb.poitl.HandlerParams;

import cn.hutool.core.util.StrUtil;

/**
 * @author zhangjun
 */
public class CommonTextTagHandler extends BaseHtmlTagHandler {
    @Override
    public void handleHtmlElement(HandlerParams params, Style style) {
        String text = "";
        if (params.getCurrentNode() instanceof TextNode) {
            text = ((TextNode) params.getCurrentNode()).text();
        }

        if (StrUtil.isNotBlank(text)) {
            TextRenderPolicy.Helper.renderTextRun(params.createRun(), new TextRenderData(text, style));
        }
    }
}
